/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.

This file is part of Quake III Arena source code.

Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.

Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
===========================================================================
*/
//
#include "ui_local.h"

// this file is only included when building a dll
// syscalls.asm is included instead when building a qvm
#ifdef Q3_VM
#error "Do not use in VM build"
#endif

//void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
//	syscall = syscallptr;
//}

uiImports_t trap;

int UI_GetAPIVersion()
{
	return UI_API_VERSION;
}

qboolean UI_HasUniqueCDKey()
{
	return qtrue;
}

static uiExports_t exportedUIAPI =
{
	UI_GetAPIVersion,

	UI_Init,
	UI_Shutdown,
	UI_KeyEvent,
	UI_MouseEvent,
	UI_Refresh,
	UI_IsFullscreen,
	UI_SetActiveMenu,
	UI_ConsoleCommand,
	UI_DrawConnectScreen,

	UI_HasUniqueCDKey,
};

void QDLLEXPORT dllEntry( void **libAPI, const void *engineAPI )
{
	memcpy(&trap, engineAPI, sizeof(uiImports_t));
	*libAPI = &exportedUIAPI;
}

int PASSFLOAT( float x ) {
	float	floatTemp;
	floatTemp = x;
	return *(int *)&floatTemp;
}

// Referenced by bg_misc.c
void	trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize )
{
	trap.Cvar_VariableStringBuffer( var_name, buffer, bufsize );
}
